# 不能使用额外空间，因此不能使用哈希表
def remove_duplicates(arr):
  next_point = 1 
  i = 1
  while (i < len(arr)):
    if (arr[next_point - 1] != arr[i]):
      arr[next_point] = arr[i]
      next_point += 1
    i += 1

  # TODO: Write your code here
  return next_point

def main():
  print("Array new length: " + str(remove_element([3, 2, 3, 6, 3, 10, 9, 3], 3)))
  print("Array new length: " + str(remove_element([2, 11, 2, 2, 1], 2)))


main()

